//
//  GYHBaseTableViewController.swift
//  sinaWeibo_18
//
//  Created by 高勇华 on 15/10/6.
//  Copyright © 2015年 高勇华. All rights reserved.
//

import UIKit

import SVProgressHUD
class GYHBaseTableViewController: UITableViewController ,GYHVisitorLoginViewDelegate{

    var visitroLoginView :GYHVisitorLoginView?
    //用来判断用户是否登录
//    let isUresLogin = GYHUserAccount.loadUserAccount() != nil
     let isUresLogin = false
    
    override func loadView() {
        
        if isUresLogin {
        
        super.loadView()
            
            return
        
        }
        
        
       // let view = UIView(frame: UIScreen.mainScreen().bounds)
        
       // view.backgroundColor = UIColor.orangeColor()
        
        //self.view = NSBundle.mainBundle().loadNibNamed("VisitorLoginView", owner: nil, options: nil).last as? GYHVisitorLoginView
        
        
        visitroLoginView = NSBundle.mainBundle().loadNibNamed("VisitorLoginView", owner: nil, options: nil).last as? GYHVisitorLoginView
        
        view = visitroLoginView
        
        visitroLoginView?.visitorDelegate = self
        
        
        self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", style: UIBarButtonItemStyle.Plain, target: self, action: "visitorWithregister")
        
        self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登录", style: UIBarButtonItemStyle.Plain, target: self, action: "visitorWithLogin")

        
        
    }
    
    
   func visitorWithregister(){
    
    print(__FUNCTION__)
    

    
    
    }
    
    func visitorWithLogin() {
       print(__FUNCTION__)
        
        let sb = UIStoryboard(name: "OAuth", bundle: nil)
        
        let vc = sb.instantiateInitialViewController() as!UINavigationController
        
        presentViewController(vc, animated: true, completion: nil)
        

    }
    
    override func viewDidLoad() {
        super.viewDidLoad()

       
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    
}
